const { ccclass, property, executeInEditMode } = cc._decorator;
const gfx = cc['gfx'];
import bezier_simulateBookAssembler from "./bezier_simulateBookAssembler";
@ccclass
// @executeInEditMode
export default class simulateBookSprite extends cc.Sprite {


    meshRenderer: cc.MeshRenderer = null;
    _bookAngle: number = 0;
    get bookAngle() {
        return this._bookAngle;
    }
    set bookAngle(v: number) {
        this._bookAngle = v;
        this.updateVertexes();
    }


    _assembler: (bezier_simulateBookAssembler) = null;

    updateVertexes() {
        //@ts-ignore
        let assembler = this._assembler;
        if (!assembler) {
            return;
        }

        assembler.bookPercent = this.bookAngle / 180;
        // assembler.genVert();
        this.setVertsDirty();
    }

    onEnable() {
        super.onEnable();
    }

    _resetAssembler() {
        // this.setVertsDirty();
        let assembler = this._assembler = new bezier_simulateBookAssembler();
        this.updateVertexes();

        assembler.init(this);

        //@ts-ignore
        this._updateColor();
    }
}
